package com.example.demo.typeEnums;

import java.util.Locale;

public enum SortType {
    /**
     * 升序排列
     */
    ASC("ASC"),

    /**
     * 降序排列
     */
    DESC("DESC"),
    ;

    private String name;

    SortType(String name) {
        this.name = name;
    }

    public String getName(){
        return name;
    }

    public static SortType getExecuteType(String name){
        name = name.toUpperCase(Locale.ROOT);
        for(SortType executeType : SortType.values()){
            if(executeType.name.equals(name)){
                return executeType;
            }
        }
        return ASC;
    }
}
